
#include	<string.h>
#include	<unistd.h>
#include	<stdlib.h>

int		main(int ac, char **av)
{
  int		pipefd[2];
  int		error;
  char		buff[512];
  int		len;

  error = pipe(pipefd);
  if (error == -1)
    {
      write(2, "Pipe failed\n", strlen("Pipe failed\n"));
      exit(EXIT_FAILURE);
    }
  write(pipefd[1], "Salut\n", 6);
  close(pipefd[1]);
  len = read(pipefd[0], buff, 511);
  if (len == -1)
    {
      write(2, "Read failed\n", strlen("Read failed\n"));
      exit(EXIT_FAILURE);
    }
  buff[len] = '\0';
  close(pipefd[0]);  
  write(1, buff, len);
}
